package zhaomh.zhlib.util;

public class TranslatableUtil {
    private final String prefix;

    /**
     * 尾部不需要加 .
     */
    public TranslatableUtil(String prefix) {
        this.prefix = prefix;
    }

    /**
     * @return prefix + . + key
     */
    public String get (String key) {
        return prefix+"."+key;
    }

    /**
     * @return prefix + . + key1 + . + key2 + ...
     */
    public String get(String... keys) {
        StringBuilder sb = new StringBuilder(prefix);
        for (String key : keys) {
            sb.append(".");
            sb.append(key);
        }
        return sb.toString();
    }
}
